package at.fhj.itm11.forum.service.impl;

import java.util.List;

import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;

import at.fhj.itm11.forum.data.IconDAO;
import at.fhj.itm11.forum.model.Icon;
import at.fhj.itm11.forum.service.IconService;
import at.fhj.itm11.forum.service.converter.DTOConverter;
import at.fhj.itm11.forum.service.converter.IconDTOConverter;
import at.fhj.itm11.forum.service.dtos.IconDTO;

@Named
@Stateless
public class IconServiceImpl implements IconService{
	
	private DTOConverter<IconDTO, Icon> iconDtoConverter = new IconDTOConverter();
	
	@Inject
	@Named("iconDAOImpl")
	private IconDAO dao;

	@Override
	public List<IconDTO> retrieveAllIconsOrderedByFileName() {
		return iconDtoConverter.convertToDto(dao.retrieveAllIconsOrderedByFileName());
	}

	@Override
	public IconDTO findIconById(Long id) {
		return iconDtoConverter.convertToDto(dao.findIconById(id));
	}

	public void setDao(IconDAO dao) {
		this.dao = dao;
	}

}
